this.BX=this.BX||{};this.BX.Landing=this.BX.Landing||{};this.BX.Landing.UI=this.BX.Landing.UI||{};(function(e,t,a,n,i){"use strict";var r,l,o,s,d;function u(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function c(e){for(var t=1;t<arguments.length;t++){var a=null!=arguments[t]?arguments[t]:{};t%2?u(Object(a),!0).forEach((function(t){babelHelpers.defineProperty(e,t,a[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(a)):u(Object(a)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(a,t))}))}return e}var p=function(e){babelHelpers.inherits(t,e);babelHelpers.createClass(t,null,[{key:"createLayout",value:function e(){return a.Tag.render(r||(r=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-field"></div>'])))}},{key:"createHeader",value:function e(){return a.Tag.render(l||(l=babelHelpers.taggedTemplateLiteral(['<div class="landing-ui-field-header"></div>'])))}},{key:"createDescription",value:function e(t){return a.Tag.render(o||(o=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-field-description">\n\t\t\t\t<span class="fa fa-info-circle"> </span> ',"\n\t\t\t</div>\n\t\t"])),t)}},{key:"createError",value:function e(t){return a.Tag.render(s||(s=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-field-description landing-ui-error">\n\t\t\t\t<span class="fa fa-info-circle"> </span> ',"\n\t\t\t</div>\n\t\t"])),t)}}]);function t(){var e;var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};babelHelpers.classCallCheck(this,t);e=babelHelpers.possibleConstructorReturn(this,babelHelpers.getPrototypeOf(t).call(this,n));e.setEventNamespace("BX.Landing.UI.Field");e.subscribeFromOptions(i.fetchEventsFromOptions(n));e.data=c({},n);e.options=e.data;e.id=Reflect.has(e.data,"id")?e.data.id:a.Text.getRandom();e.selector=Reflect.has(e.data,"selector")?e.data.selector:a.Text.getRandom();e.content=Reflect.has(e.data,"content")?e.data.content:"";e.title=a.Type.isString(e.data.title)?e.data.title:"";e.placeholder=a.Type.isString(e.data.placeholder)?e.data.placeholder:"";e.className=a.Type.isString(e.data.className)?e.data.className:"";e.descriptionText=a.Type.isString(e.data.description)?e.data.description:"";e.description=null;e.attribute=a.Type.isString(e.data.attribute)?e.data.attribute:"";e.hidden=a.Text.toBoolean(e.data.hidden);e.property=a.Type.isString(e.data.property)?e.data.property:"";e.style=Reflect.has(e.data,"style")?e.data.style:"";e.cache=new a.Cache.MemoryCache;e.contentRoot=Reflect.has(e.data,"contentRoot")?e.data.contentRoot:null;e.readyToSave=true;var r=e.data.onValueChange;e.onValueChangeHandler=a.Type.isFunction(r)?r:function(){};e.onPaste=e.onPaste.bind(babelHelpers.assertThisInitialized(e));e.layout=t.createLayout();e.header=t.createHeader();e.input=e.createInput();e.setTitle(e.title);a.Dom.append(e.header,e.layout);a.Dom.append(e.input,e.layout);a.Dom.attr(e.layout,"data-selector",e.selector);e.input.setAttribute("data-placeholder",e.placeholder);if(a.Type.isArrayLike(e.className)){a.Dom.addClass(e.layout,e.className)}e.setDescription(e.descriptionText);if(e.data.disabled===true){e.disable()}if(n.skipPasteControl!==true){a.Event.bind(e.input,"paste",e.onPaste)}e.init();if(e.data.help){var l=document.createElement("span");l.setAttribute("data-hint",e.data.help);l.setAttribute("data-hint-html","y");top.BX.UI.Hint.initNode(l);BX.Dom.append(l,e.header);top.BX.UI.Hint.init(BX.Landing.UI.Panel.StylePanel.getInstance().layout)}return e}babelHelpers.createClass(t,[{key:"setTitle",value:function e(t){this.header.innerHTML=a.Text.encode(t)}},{key:"getDescription",value:function e(){return this.layout.querySelector(".landing-ui-field-description")}},{key:"setDescription",value:function e(n){if(a.Type.isString(n)&&n!==""){this.descriptionText=n;this.description=t.createDescription(this.descriptionText);a.Dom.remove(this.getDescription());a.Dom.append(this.description,this.layout)}}},{key:"removeDescription",value:function e(){a.Dom.remove(this.getDescription());this.description=null;this.descriptionText=""}},{key:"createInput",value:function e(){return a.Tag.render(d||(d=babelHelpers.taggedTemplateLiteral(['\n\t\t\t<div class="landing-ui-field-input">',"</div>\n\t\t"])),this.content)}},{key:"init",value:function e(){}},{key:"getContext",value:function e(){if(this.input.ownerDocument){return this.input.ownerDocument.defaultView}return window}},{key:"onPaste",value:function e(t){t.preventDefault();t.stopPropagation();if(t.clipboardData&&t.clipboardData.getData){var a=t.clipboardData.getData("text/plain");var n=BX.Text.encode(a);var i=n.replace(new RegExp("\n","g"),"<br>");this.getContext().document.execCommand("insertHTML",false,i)}else{var r=window.clipboardData.getData("text");this.getContext().document.execCommand("paste",true,BX.Text.encode(r))}}},{key:"getNode",value:function e(){return this.layout}},{key:"isChanged",value:function e(){var t=this;var n=function(){if(a.Type.isNil(t.content)){return""}if(a.Type.isString(t.content)){return t.content.trim()}return t.content}();return n!==this.getValue()}},{key:"getValue",value:function e(){return this.input.innerHTML.trim()}},{key:"setValue",value:function e(){var t=arguments.length>0&&arguments[0]!==undefined?arguments[0]:"";var n=this.textOnly?a.Text.encode(t):t;this.input.innerHTML=n.toString().trim();this.onValueChangeHandler(this);var i=new a.Event.BaseEvent({data:{value:this.getValue()},compatData:[this.getValue()]});this.emit("change",i);this.emit("onChange",i)}},{key:"enable",value:function e(){a.Dom.attr(this.layout,"disabled",null);a.Dom.removeClass(this.layout,"landing-ui-disabled")}},{key:"disable",value:function e(){a.Dom.attr(this.layout,"disabled",true);a.Dom.addClass(this.layout,"landing-ui-disabled")}},{key:"reset",value:function e(){}},{key:"onFrameLoad",value:function e(){}},{key:"clone",value:function e(t){return new this.constructor(a.Runtime.clone(t||this.data))}},{key:"getLayout",value:function e(){return this.layout}},{key:"setLayoutClass",value:function e(t){a.Dom.addClass(this.layout,t)}},{key:"getInlineProperties",value:function e(){return[]}},{key:"getComputedProperties",value:function e(){return[]}},{key:"getPseudoElement",value:function e(){return null}}]);return t}(n.EventEmitter);babelHelpers.defineProperty(p,"currentField",null);e.BaseField=p})(this.BX.Landing.UI.Field=this.BX.Landing.UI.Field||{},BX,BX,BX.Event,BX.Landing.UI.Component);
//# sourceMappingURL=basefield.bundle.map.js